<script lang="ts">
export default {
  name: 'manage',
};
</script>

<script lang="ts" setup>

import {onMounted, reactive, ref} from 'vue';

import RepoCompEntityTable from './components/RepoCompEntityTable.vue';
import RepoCompEntityHeader from './components/RepoCompEntityHeader.vue';

// 引入设备的API和数据类型
import {
  RepoCompQueryParam,
} from '@/api/cloud/repository/repocomp/model/types';

const repoCompEntityTableRef = ref<any>(); // 这了的变量名称必须和<console-edit-dialog>的ref值一样
const repoCompEntityHeaderRef = ref<any>(); // 这了的变量名称必须和<console-edit-dialog>的ref值一样

const dataState = reactive({
  // 查询参数
  queryParams: {pageNum: 1, pageSize: 10} as RepoCompQueryParam,
  // 对话框状态
  editDialog: {
    visible: false,
  },
  // 对话框状态
  versionDialog: {
    visible: false,
  },
});


/**
 * 捕获对话框的取消操作
 * @taskParam value
 */
function handleCancel() {
  // 隐藏对话框
  dataState.editDialog.visible = false;
}

/**
 * 响应查询按钮：页查询数据
 */
function handleQuery(source: string, value: any) {
  dataState.queryParams = value;
  repoCompEntityTableRef.value.refreshTable(dataState.queryParams);
}

/**
 * 响应页面安装：页面的初始化工作
 */
onMounted(() => {
});
</script>

<template>
  <div class="app-container">

    <!-- 表单头：各种按钮 -->
    <repo-comp-entity-header ref="repoCompEntityHeaderRef"
                             :modelType="'jsn-model'"
                             @query="handleQuery"
    />

    <!-- 数据表单：创建/修改 -->
    <repo-comp-entity-table ref="repoCompEntityTableRef"
                            :modelType="'jsn-model'"
    />

  </div>
</template>
